//
//  BehaviorDecorator.m
//  Charles
//
//  Created by Leo on 2017/6/13.
//  Copyright © 2017年 charles. All rights reserved.
//

#import "BehaviorDecorator.h"

@implementation BehaviorDecorator

- (NSString *)behavior {
    if (self.component) {
      return [self.component behavior];
    }else {
        return nil;
    }
}

- (void)setComponent:(Animal *)component {
    _component = component;
}

@end


@implementation Eat

- (NSString *)behavior {
   return [[super behavior] stringByAppendingString:@"、吃"];
}

@end

@implementation Fly

- (NSString *)behavior {
   return [[super behavior] stringByAppendingString:@"、天上飞"];
}

@end

@implementation Shout

- (NSString *)behavior {
   return [[super behavior] stringByAppendingString:@"、叫喊"];
}

@end

@implementation Run

- (NSString *)behavior {
    return [[super behavior] stringByAppendingString:@"、地上走"];
}

@end


